<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>系统参数</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/temp/layui/css/layui.css" media="all">

    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>           
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>系统参数</legend>
</fieldset>

<form class="layui-form layui-form-pane" action="" lay-filter="example" style="padding: 20px">
    <input type="hidden" name="id" value="{$info.id}" lay-verify="id">

    <div class="layui-form-item">
        <label class="layui-form-label">客服电话</label>
        <div class="layui-input-inline" style="width: 40%">
            <input type="text" name="cust_phone" value="{$info.cust_phone}" lay-verify="cust_phone" autocomplete="off" placeholder="请输入客服电话" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">提现日期</label>
        <div class="layui-input-inline" style="width: 40%">
            <input type="number" name="cash_day" value="{$info.cash_day}" lay-verify="cash_day" autocomplete="off" placeholder="请输入提现日期" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">
            <span style="color: red">*</span> 每月提现日
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">提现限额</label>
        <div class="layui-input-inline" style="width: 40%">
            <input type="number" name="cash_number" value="{$info.cash_number}" lay-verify="cash_number" autocomplete="off" placeholder="请输入提现最低限额" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">
            <span style="color: red">*</span> 提现最低限额（0表示不限额）
        </div>
    </div>

    <div class="layui-form-item" pane="" style="width: 47.5%">
        <label class="layui-form-label">分享限制</label>
        <div class="layui-input-inline">
            {if $info['is_push'] == 1}
            <input type="checkbox" checked name="is_push" value="1" lay-skin="switch" lay-text="是|否">
            {else /}
            <input type="checkbox" name="is_push" value="1" lay-skin="switch" lay-text="是|否">
            {/if}
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">小程序人脸</label>
        <div class="layui-input-inline" style="width: 40%">
            <input type="number" name="is_face" value="{$info.is_face}" lay-verify="is_face" autocomplete="off" placeholder="请输入0或者1" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">
            <span style="color: red">*</span> 小程序端的人脸开关(0=关，1=开)
        </div>
    </div>

    <!-- <div class="layui-form-item">
        <label class="layui-form-label">拉新限制</label>
        <div class="layui-input-inline" style="width: 40%">
            <input type="number" name="push_number" value="{$info.push_number}" lay-verify="push_number" autocomplete="off" placeholder="请输入提现拉新限制" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">
            <span style="color: red">*</span> 拉新满足人数赠送体验卡（0表示不限制）
        </div>
    </div> -->

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="submit">立即提交</button>
        </div>
    </div>
</form>
          
<script src="/static/temp/layui/layui.js" charset="utf-8"></script>

<script>
    layui.use(['form', 'layedit'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit;

        // 监听提交
        form.on('submit(submit)', function(data){
            if(!data.field.is_push){
                data.field.is_push = 0;
            }

            console.log(data.field)
            $.post('{:url("System/setEdit")}', data.field, function(res){
                if(res.code == 0){
                    layer.msg(res.msg, {icon: 1});
                    setTimeout(() => {
                        window.location.href = "{:url('System/system_list')}";
                    }, 1000);
                }else{
                    layer.msg(res.msg, {icon: 2});
                }
            })

            return false;
        });
    });
</script>
</body>
</html>